<!DOCTYPE html>
<html>
<head>
    <% include("/common/title.html"){} %>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="col-sm-12">
        <div class="example">
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>查询条件</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                    隐藏
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <div class="row form-horizontal">
                                <div class="col-sm-10">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">订单号</label>
                                        <div class="col-sm-2">
                                            <input type="text" id="orderNo" placeholder="请输入参数名称"
                                                   class="form-control">
                                        </div>
                                        <label class="col-sm-2 control-label">手机号</label>
                                        <div class="col-sm-2">
                                            <input type="text" id="phone" placeholder="请输入参数名称"
                                                   class="form-control">
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">邮箱</label>
                                            <div class="col-sm-2">
                                                <input type="text" id="email" placeholder="请输入参数名称"
                                                       class="form-control">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">类型</label>
                                            <div class="col-sm-2">
                                                <select class="form-control" name="type" id="type">
                                                    <option value="">请选择</option>
                                                    <option value="1">开票</option>
                                                    <option value="2">冲红</option>
                                                </select>
                                            </div>

                                            <label class="col-sm-2 control-label">状态</label>
                                            <div class="col-sm-2">
                                                <select class="form-control" name="ticketStatus" id="ticketStatus">
                                                    <option value="">请选择</option>
                                                    <option value="5">开票中</option>
                                                    <option value="6">成功</option>
                                                    <option value="3">失败</option>
                                                </select>

                                            </div>
                                        </div>

                                    </div>
                                </div>
                                <div class="col-sm-2">
                                    <p>
                                        <button class="btn  btn-primary" onclick="searchTable()"
                                                type="submit"><strong>查询</strong>
                                        </button>
                                        <button class="btn  btn-white"
                                                type="submit" onclick="clearSearchBtn()"><strong>清空查询条件</strong>
                                        </button>
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="ibox-content">
                <table id="tablepager" data-mobile-responsive="true">
                </table>
            </div>
        </div>
    </div>
</div>
<div id="editer_form_div" style="display: none;">
    <form class="form-horizontal" id="myForm">
        <div class="col-md-12">
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">日志类型 :</label>
                <div class="col-sm-6">
                    <span id="f_sp_log_type" name="f_sp_log_type"></span>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">时间 :</label>
                <div class="col-sm-6">
                    <span id="f_create_time" name="f_create_time"></span>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">状态(错误信息) :</label>
                <div class="col-sm-6">
                    <span id="f_status" name="f_status"></span>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">耗时（ms） :</label>
                <div class="col-sm-6">
                    <span id="f_duration" name="f_duration"></span>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请求参数 :</label>
                <div class="col-sm-6">
                    <span id="f_request" name="f_request"></span>
                </div>
            </div>
            <div class="form-group" id="showBusinessRequest" style="display: none;">
                <label class="col-sm-2 control-label">请求业务参数 :</label>
                <div class="col-sm-6">
                    <span id="f_business_request" name="f_business_request"></span>
                </div>
            </div>
            <div class="form-group" id="showOneImg" style="display: none;">
                <label class="col-sm-2 control-label">请求参数img :</label>
                <div class="col-sm-3">
                    <p class="text-center" style="">
                        <img id="imgOne" class="img-rounded">
                    </p>
                </div>
            </div>
            <div class="form-group" id="showTwoImg" style="display: none;">
                <label class="col-sm-2 control-label">请求参数img :</label>
                <div class="col-sm-3">
                    <p class="text-center">
                        <img ondblclick="bigImg()" id="imgTwo" class="img-rounded col-sm-12 ">
                    </p>
                    <p class="text-center">
                        <img ondblclick="bigImg()" id="imgThree" class="img-rounded col-sm-12">
                    </p>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">响应信息 :</label>
                <div class="col-sm-6">
                    <span id="f_response" name="f_response"></span>
                </div>
            </div>
        </div>
    </form>
</div>
<% include("/common/commonjs.html"){} %>
<script type="text/javascript">

    $(function () {
        loadData();
    });

    function loadData() {
        var url = "${ctxPath }/invoice/page";
        $('#tablepager').bootstrapTable({
            url: url,
            dataType: "json",
            pagination: true, //分页
            singleSelect: true,//只能选择一行
            clickToSelect: true,
            search: false, //显示搜索框
            sidePagination: "server", //服务端处理分
            pageNumber: 1,
            pageSize: 10,
            pageList: [10, 20, 50, 100],
            queryParams: function (params) {
                var par = {
                    "orderNo": $("#orderNo").val(),
                    "phone": $("#phone").val(),
                    "type": $("#type").val(),
                    "ticketStatus": $("#ticketStatus").val(),
                    "email": $("#email").val()

                };
                var p = $.extend({}, params, par);
                return p;
            },
            showColumns: true,
            showRefresh: true,
            showToggle: true,
            toolbar: "#tableToolbar",
            columns: [{
                field: "f_create_time",
                title: "开票时间",
                width: 120
            }, {
                field: "ticket_status",
                title: "类型",
                formatter: function (value, row) {
                    if (row.type == 1) {
                        return "开票";
                    } else if (row.type == 2) {
                        return "冲红";
                    }
                },
                width: 100
            }, {
                field: "orderNo",
                title: "订单号",
                width: 120
            }, {
                field: "phone",
                title: "手机号",
                width: 120
            }, {
                field: "email",
                title: "邮箱",
                width: 100
            }, {
                field: "ticket_status",
                title: "状态",
                formatter: function (value, row) {
                    if (row.ticketStatus == 1 || row.ticketStatus == 5) {
                        return "开票中";
                    } else if (row.ticketStatus == 2 || row.ticketStatus == 4) {
                        return "成功";
                    } else if (row.ticketStatus == 3) {
                        return "失败";
                    }
                },
                width: 100
            }, {
                field: "reason",
                title: "原因",
                width: 120
            }, {
                field: "invoiceNo",
                title: "发票流水号",
                width: 120
            }, {
                field: "invoiceAddress",
                title: "发票地址",
                width: 200
            }]
        });
    }


    function searchTable() {
        $('#tablepager').bootstrapTable("refresh");
    }


    function clearSearchBtn() {
        $("#orderNo").val("");
        $("#phone").val("");
        $("#type").val("");
        $("#ticketStatus").val("");
        $("#email").val("");

    }
</script>
</body>
</html>

</body>




